
<%@ page import="cn.entity.News1" %>
<%@ page import="cn.NewsDao.NewsDao1" %>
<%@ page import="cn.NewsDaoImpl.NewsDaoImpl1" %><%--
  Created by IntelliJ IDEA.
  User: 31052
  Date: 2022/4/6
  Time: 19:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
        <%
            //接收数据
            request.setCharacterEncoding("utf-8");
            String userName=request.getParameter("userName");
            String password=request.getParameter("password");


            News1 news = new News1();
            news.setCategoryId(Integer.parseInt(userName) );
            news.setTitle(password);





            NewsDao1 newsDao1 = new NewsDaoImpl1();


            if (newsDao1.add(news)){
                response.sendRedirect(request.getContextPath()+"/index2.jsp");
            }else {
        %>
        <div>增加失败</div>
        <%
            }

        %>
</body>
</html>
